home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat2
/
standard
/
sprofil.z
/
sprofil
Wrap
Text File
|
1998-10-20
|
9KB
|
198 lines
SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222)))) SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222))))
NNNNAAAAMMMMEEEE
sprofil - execution time profile for disjoint text spaces
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttiiiimmmmeeee....hhhh>>>>
####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////pppprrrrooooffffiiiillll....hhhh>>>>
iiiinnnntttt sssspppprrrrooooffffiiiillll((((ssssttttrrrruuuucccctttt pppprrrrooooffff ****pppprrrrooooffffpppp,,,, iiiinnnntttt pppprrrrooooffffccccnnnntttt,,,,
ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttvvvvpppp,,,, uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt ffffllllaaaaggggssss))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
sssspppprrrrooooffffiiiillll provides CPU-use statistics by profiling the amount of CPU time
expended by a program in disjoint text spaces. This is useful if you
need to profile programs using shared libraries or profile an address
space using different granularities for different sections of text.
sssspppprrrrooooffffiiiillll generates the statistics by creating an execution histogram for a
current process. The histogram is defined for a list of regions of
program code to be profiled specified by members of the _p_r_o_f_p array:
profp[0], profp[1], ..., profp[profcnt-1].
The _p_r_o_f structure is defined as
struct prof {
void *pr_base; /* buffer base */
unsigned pr_size; /* buffer size */
__psunsigned_t pr_off; /* pc offset */
unsigned pr_scale; /* pc scaling */
};
Each _p_r_o_f entry specifies a region of text space that needs to be
profiled, and the fields of the structure take on the same meaning as the
arguments of the pppprrrrooooffffiiiillll((((2222)))) system call.
_p_r__b_a_s_e is a buffer of _p_r__s_i_z_e bytes in which the histogram counts are
stored.
_p_r__o_f_f , _p_r__s_c_a_l_e , and _p_r__s_i_z_e specify the region to be profiled.
_p_r__o_f_f is effectively the start address of the region to be profiled.
If non-NULL, _t_v_p points to a _s_t_r_u_c_t _t_i_m_e_v_a_l which on return will contain
the time value corresponding to one clock tick.
Valid _f_l_a_g_s values include PPPPRRRROOOOFFFF____UUUUSSSSHHHHOOOORRRRTTTT and PPPPRRRROOOOFFFF____UUUUIIIINNNNTTTT, which result in the
_p_r__b_a_s_e field of each _p_r_o_f entry being treated as a pointer to an array
of _u_n_s_i_g_n_e_d _s_h_o_r_t or _u_n_s_i_g_n_e_d _i_n_t, respectively. You achieve a 1-1
mapping of instructions to counters for PPPPRRRROOOOFFFF____UUUUSSSSHHHHOOOORRRRTTTT and a _p_r__s_c_a_l_e of
0x8000, or PPPPRRRROOOOFFFF____UUUUIIIINNNNTTTT and a _p_r__s_c_a_l_e of 0x10000. Note that a 1-1 mapping
of PPPPRRRROOOOFFFF____UUUUIIIINNNNTTTT counters consumes twice as much space as for PPPPRRRROOOOFFFF____UUUUSSSSHHHHOOOORRRRTTTT
counters, and should only be used in those cases where you expect a 16-
bit counter to overflow.
PPPPaaaaggggeeee 1111
SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222)))) SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222))))
Callers may also specify PPPPRRRROOOOFFFF____FFFFAAAASSSSTTTT in the _f_l_a_g_s field. This value will
provide more accurate profiling by forcing the system to take samples
once every millisecond. Fast profiling requests can reduce system
performance noticably. The tuneable system parameter rrrreeeessssttttrrrriiiicccctttt____ffffaaaassssttttpppprrrrooooffff
can be used to disable this feature.
If overlapping text regions are specified, then the _p_r__b_a_s_e associated
with the largest offset less than the value of the program counter(PC)
gets incremented. If more than one text region has the same offset, the
first one is chosen.
A text region with the _p_r__o_f_f of 0 and _p_r__s_c_a_l_e of 0x0002 will act as an
overflow bin. Any PC value not previously matched or outside the regions
of text space specified is considered to match this text region and the
first counter of the specified _p_r__b_a_s_e is incremented. If specified, such
an overflow bin should always be last in the list of specified regions.
sssspppprrrrooooffffiiiillll can fail with:
[E2BIG] _p_r_o_f_c_n_t was less than or equal to 0, or greater than
PPPPRRRROOOOFFFFIIIILLLL____MMMMAAAAXXXX....
[EFAULT] Either _p_r_o_f_p or _t_v_p points to an illegal address.
[EINVAL] The overflow bin is not last in the list of specified
regions, or _f_l_a_g_s does not contain one of the values
(PPPPRRRROOOOFFFF____UUUUSSSSHHHHOOOORRRRTTTT or PPPPRRRROOOOFFFF____UUUUIIIINNNNTTTT).
[EACCES] The _f_l_a_g_s field specified PPPPRRRROOOOFFFF____FFFFAAAASSSSTTTT but the feature has been
disabled using the rrrreeeessssttttrrrriiiicccctttt____ffffaaaassssttttpppprrrrooooffff tuneable system
parameter or the hardware does not support fast clock ticks.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
If successful, sssspppprrrrooooffffiiiillll returns 0. Otherwise, a -1 is returned and the
global variable eeeerrrrrrrrnnnnoooo is set to indicate the error.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
profil(2), prof(1), times(2), monitor(3X), intro(2).
NNNNOOOOTTTTEEEESSSS
Each call to sssspppprrrrooooffffiiiillll will disable any profiling enabled by previous
sssspppprrrrooooffffiiiillll calls. Profiling is not enabled for a given text region if the
value for _p_r__s_c_a_l_e is 0 or 1, and is rendered ineffective by giving a
_b_u_f_s_i_z of 0. Profiling is turned off for the specified region of text
space if a _p_r__b_a_s_e update would cause a memory fault.
Profiling is turned off when an eeeexxxxeeeecccc((((2222)))) is executed, but remains on in
both child and parent processes after a ffffoooorrrrkkkk((((2222)))) or a sssspppprrrroooocccc((((2222)))).... A call to
pppprrrrooooffffiiiillll((((2222)))) has the same effect as calling sssspppprrrrooooffffiiiillll with just one member in
the _p_r_o_f_p array with the fields _p_r_o_f_c_n_t, _t_v_p and _f_l_a_g_s taking on the
values of 1, NULL and PROF_USHORT respectively.
PPPPaaaaggggeeee 2222
SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222)))) SSSSPPPPRRRROOOOFFFFIIIILLLL((((2222))))
PPPPaaaaggggeeee 3333